// AUTO GENERATED CODE!
// CODE GENERATOR WILL NOT PRESERVE MANUAL CHANGES TO THIS CODE!
// 

// MIT License (MIT)
// 
// Copyright (c) 2014 K Ercan Turkarslan
// 
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// 
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
// 


using System;

namespace Mios.Generated.ServiceFiles
{
    // Generated from S_AlarmPartition2.xml
    
    public class AlarmPartition2Service : MiosService
    {
        #region ArmMode : String;
        private String _mArmMode;
        
        public String ArmMode
        {
            get
            {
                return _mArmMode ?? GetArmMode();
            }
        }
        
        #region Action SetArmMode(String newArmMode) : String;
        public String SetArmMode(String newArmMode)
        {
            if (String.IsNullOrEmpty(newArmMode))
                throw new ArgumentNullException("newArmMode");
            
            switch(newArmMode)
            {
                case "Disarmed":
                case "Armed":
                    break;
                
                default:
                    throw new ArgumentOutOfRangeException("newArmMode");
            }
            
            return Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "SetArmMode",
                String.Format("newArmMode={0}", ToLuup(_mArmMode = newArmMode)));
        }
        #endregion Action SetArmMode
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetArmMode() : String;
        public String GetArmMode()
        {
            _mArmMode = FromLuupString(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "ArmMode"));
            
            return _mArmMode;
        }
        #endregion Action GetArmMode
        
        #endregion
        
        #region DetailedArmMode : String;
        private String _mDetailedArmMode;
        
        public String DetailedArmMode
        {
            get
            {
                return _mDetailedArmMode ?? GetDetailedArmMode();
            }
        }
        
        #region Action SetDetailedArmMode(String newDetailedArmMode) : String;
        public String SetDetailedArmMode(String newDetailedArmMode)
        {
            if (String.IsNullOrEmpty(newDetailedArmMode))
                throw new ArgumentNullException("newDetailedArmMode");
            
            switch(newDetailedArmMode)
            {
                case "Disarmed":
                case "Armed":
                case "ArmedInstant":
                case "Stay":
                case "StayInstant":
                case "Night":
                case "NightInstant":
                case "Force":
                case "Ready":
                case "Vacation":
                case "NotReady":
                case "FailedToArm":
                case "EntryDelay":
                case "ExitDelay":
                    break;
                
                default:
                    throw new ArgumentOutOfRangeException("newDetailedArmMode");
            }
            
            return Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "SetDetailedArmMode",
                String.Format("newDetailedArmMode={0}", ToLuup(_mDetailedArmMode = newDetailedArmMode)));
        }
        #endregion Action SetDetailedArmMode
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetDetailedArmMode() : String;
        public String GetDetailedArmMode()
        {
            _mDetailedArmMode = FromLuupString(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "DetailedArmMode"));
            
            return _mDetailedArmMode;
        }
        #endregion Action GetDetailedArmMode
        
        #endregion
        
        #region Alarm : String;
        private String _mAlarm;
        
        public String Alarm
        {
            get
            {
                return _mAlarm ?? GetAlarm();
            }
        }
        
        #region Action SetAlarm(String newAlarm) : String;
        public String SetAlarm(String newAlarm)
        {
            if (String.IsNullOrEmpty(newAlarm))
                throw new ArgumentNullException("newAlarm");
            
            switch(newAlarm)
            {
                case "None":
                case "Active":
                    break;
                
                default:
                    throw new ArgumentOutOfRangeException("newAlarm");
            }
            
            return Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "SetAlarm",
                String.Format("newAlarm={0}", ToLuup(_mAlarm = newAlarm)));
        }
        #endregion Action SetAlarm
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetAlarm() : String;
        public String GetAlarm()
        {
            _mAlarm = FromLuupString(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "Alarm"));
            
            return _mAlarm;
        }
        #endregion Action GetAlarm
        
        #endregion
        
        #region ChimeEnabled : Boolean;
        private Boolean? _mChimeEnabled;
        
        public Boolean ChimeEnabled
        {
            get
            {
                return _mChimeEnabled ?? GetChimeEnabled();
            }
        }
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetChimeEnabled() : Boolean;
        public Boolean GetChimeEnabled()
        {
            _mChimeEnabled = FromLuupBoolean(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "ChimeEnabled"));
            
            return _mChimeEnabled.Value;
        }
        #endregion Action GetChimeEnabled
        
        #endregion
        
        #region AlarmMemory : Boolean;
        private Boolean? _mAlarmMemory;
        
        public Boolean AlarmMemory
        {
            get
            {
                return _mAlarmMemory ?? GetAlarmMemory();
            }
        }
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetAlarmMemory() : Boolean;
        public Boolean GetAlarmMemory()
        {
            _mAlarmMemory = FromLuupBoolean(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "AlarmMemory"));
            
            return _mAlarmMemory.Value;
        }
        #endregion Action GetAlarmMemory
        
        #endregion
        
        #region LastAlarmActive : UInt32;
        private UInt32? _mLastAlarmActive;
        
        public UInt32 LastAlarmActive
        {
            get
            {
                return _mLastAlarmActive ?? GetLastAlarmActive();
            }
        }
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetLastAlarmActive() : UInt32;
        public UInt32 GetLastAlarmActive()
        {
            _mLastAlarmActive = FromLuupUInt32(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "LastAlarmActive"));
            
            return _mLastAlarmActive.Value;
        }
        #endregion Action GetLastAlarmActive
        
        #endregion
        
        #region LastUser : String;
        private String _mLastUser;
        
        public String LastUser
        {
            get
            {
                return _mLastUser ?? GetLastUser();
            }
        }
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetLastUser() : String;
        public String GetLastUser()
        {
            _mLastUser = FromLuupString(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "LastUser"));
            
            return _mLastUser;
        }
        #endregion Action GetLastUser
        
        #endregion
        
        #region VendorStatus : String;
        private String _mVendorStatus;
        
        public String VendorStatus
        {
            get
            {
                return _mVendorStatus ?? GetVendorStatus();
            }
        }
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetVendorStatus() : String;
        public String GetVendorStatus()
        {
            _mVendorStatus = FromLuupString(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "VendorStatus"));
            
            return _mVendorStatus;
        }
        #endregion Action GetVendorStatus
        
        #endregion
        
        #region VendorStatusCode : String;
        private String _mVendorStatusCode;
        
        public String VendorStatusCode
        {
            get
            {
                return _mVendorStatusCode ?? GetVendorStatusCode();
            }
        }
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetVendorStatusCode() : String;
        public String GetVendorStatusCode()
        {
            _mVendorStatusCode = FromLuupString(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "VendorStatusCode"));
            
            return _mVendorStatusCode;
        }
        #endregion Action GetVendorStatusCode
        
        #endregion
        
        #region VendorStatusData : String;
        private String _mVendorStatusData;
        
        public String VendorStatusData
        {
            get
            {
                return _mVendorStatusData ?? GetVendorStatusData();
            }
        }
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetVendorStatusData() : String;
        public String GetVendorStatusData()
        {
            _mVendorStatusData = FromLuupString(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "VendorStatusData"));
            
            return _mVendorStatusData;
        }
        #endregion Action GetVendorStatusData
        
        #endregion
        
        
        #region Action RequestArmMode(String state, String pINCode)
        public void RequestArmMode(String state, String pINCode)
        {
            if (String.IsNullOrEmpty(state))
                throw new ArgumentNullException("state");
            
            if (String.IsNullOrEmpty(pINCode))
                throw new ArgumentNullException("pINCode");
            
            Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "RequestArmMode"
                , String.Format("State={0}", ToLuup(state))
                , String.Format("PINCode={0}", ToLuup(pINCode))
                ); // Engine.Luup_CallAction
        }
        #endregion Action RequestArmMode
        
        #region Action RequestQuickArmMode(String state)
        public void RequestQuickArmMode(String state)
        {
            if (String.IsNullOrEmpty(state))
                throw new ArgumentNullException("state");
            
            Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "RequestQuickArmMode"
                , String.Format("State={0}", ToLuup(state))
                ); // Engine.Luup_CallAction
        }
        #endregion Action RequestQuickArmMode
        
        #region Action RequestPanicMode(String state)
        public void RequestPanicMode(String state)
        {
            if (String.IsNullOrEmpty(state))
                throw new ArgumentNullException("state");
            
            Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "RequestPanicMode"
                , String.Format("State={0}", ToLuup(state))
                ); // Engine.Luup_CallAction
        }
        #endregion Action RequestPanicMode
        
        
        #region Method SetVariable(String name, String value) : Boolean;
        internal override Boolean SetVariable(String name, String value)
        {
            switch(name)
            {
                case "Alarm":
                    _mAlarm = FromLuupString(value); return true;
                case "AlarmMemory":
                    _mAlarmMemory = FromLuupBoolean(value); return true;
                case "ArmMode":
                    _mArmMode = FromLuupString(value); return true;
                case "ChimeEnabled":
                    _mChimeEnabled = FromLuupBoolean(value); return true;
                case "DetailedArmMode":
                    _mDetailedArmMode = FromLuupString(value); return true;
                case "LastAlarmActive":
                    _mLastAlarmActive = FromLuupUInt32(value); return true;
                case "LastUser":
                    _mLastUser = FromLuupString(value); return true;
                case "VendorStatus":
                    _mVendorStatus = FromLuupString(value); return true;
                case "VendorStatusCode":
                    _mVendorStatusCode = FromLuupString(value); return true;
                case "VendorStatusData":
                    _mVendorStatusData = FromLuupString(value); return true;
                default:
                    return false;
            }
        }
        #endregion Method SetVariable
        
        public AlarmPartition2Service(MiosEngine engine, UInt32 deviceId, String serviceId)
            : base(engine, deviceId, serviceId)
        {
            
        } //End Constructor
    } //End of class
} //End of Namespace

